package chapter.fourth.item14;

import com.alibaba.fastjson.JSON;

public final class Time {
	private static final int HOURS_PER_DAY = 24;
	private static final int MINUTES_PER_HOUR = 60;
	volatile int hour;
	volatile int minute;
	public Time(int hour, int minute) {
		if(hour<0||hour>=HOURS_PER_DAY){
			throw new IllegalArgumentException("hour:"+hour);
		}
		if(minute<0||minute>=MINUTES_PER_HOUR){
			throw new IllegalArgumentException("miute:"+minute);
		}
		this.hour = hour;
		this.minute = minute;
	}
	
	
	
	public int getHour() {
		return hour;
	}



	public int getMinute() {
		return minute;
	}



	public static void main(String[] args) {
		Time time = new Time(10,32);
		time.hour = 11;
		System.out.println(JSON.toJSONString(time));
	}
	
	
}
